package com.wh1200.xmlless.test.dao

import com.wh1200.mybatis.xmlless.XmlLessMapper
import com.wh1200.mybatis.xmlless.annotations.XmllessMethod
import com.wh1200.xmlless.test.model.AppCluster
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable

/**
 *
 * @author 吴昊
 * @since 0.0.1
 */
@Mapper
interface AppClusterDAO : XmlLessMapper<AppCluster> {

  /**
   * @param cluster
   * @return
   */
  fun save(cluster: AppCluster): Int

  /**
   * @param keywords
   * @param pageable
   * @return
   */
  @XmllessMethod(
      conditions = ["name like keywords or url like keywords"]
  )
  fun findAll(
      @Param("keywords") keywords: String?,
      @Param("pageable") pageable: Pageable
  ): Page<AppCluster>

}
